<?php

namespace C\S\User;

use C\L\Service;

class Address extends Service
{
    protected function setModel()
    {
        $this->model = new \C\M\UserAddress();
    }

    public function getStatusConfig()
    {
        return [
        'is_default_name' => [
        'Y' => '是',
        'N' => '否',
        ]
        ];
    }

    public function getAddress($uid)
    {
        $info = $this->search(['uid' => $uid, 'is_default' => 'Y']);
        if (!$info) {
            return '';
        }
        $address = sprintf(
            '%s %s %s%s%s%s',
            $info['name'],
            $info['tel'],
            $info['province'],
            $info['city'],
            $info['county'],
            $info['address']
        );
        return $address;
    }
}
